var util = {};
util.AjaxTickerTape = function(elementId, timerInterval, newsItem_left){
	this.elementId = elementId;	
	this.timerInterval = timerInterval;	
	this.newsItem_left = newsItem_left;	
}

util.AjaxTickerTape.prototype = {
	startTicker: function(){
		var tickerTape = this; //
		this.tickerId = setTimeout( 
			
				function(){ 
					tickerTape.playTicker.call(tickerTape);
				}
				, this.timerInterval );
	},
	stopTicker: function(){
		clearTimeout( this.tickerId );
	},
	playTicker: function(){
		//alert('this.elementId='+this.elementId);
		var newsItem = document.getElementById( this.elementId );
		newsItem.style.left = this.newsItem_left +'px';
		this.newsItem_left -= 10;
		if( this.newsItem_left < -150){
			this.newsItem_left = 150;
			//stopTicker();
			//loadNews();
		}
		var tickerTape = this;
		this.tickerId = setTimeout( 
				function(){
					tickerTape.playTicker.call(tickerTape);
				}
				, this.timerInterval );
	}
}

window.onload = function(){
	new util.AjaxTickerTape( 'urlItem', 120, 150).startTicker();
}











